<script type="text/javascript"><!--//--><![CDATA[//><!--

    var grid_reload = function() {
        $('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
    };
    
    $(document).ready(function() {
       // Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			//singleSelect:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center' },
				{ field : 'kode_customer', title : 'Kode Client', width : 120, sortable:true },
				{ field : 'nama_customer', title : 'Nama Client', width : 170, sortable:true },
				{ field : 'no_invoice', title : 'No Invoice', width : 200, sortable:true },
				{ field : 'tanggal_invoice', title : 'Tanggal Invoice', width : 100, sortable:true },
				{ field : 'status', title : 'Status', width : 100, sortable:true },
				{ field : 'total_bayar', title : 'Total Bayar', width : 100, sortable:true },	
				{ field : 'tanggal_bayar', title : 'Tanggal Bayar', width : 100, sortable:true },
				{ field : 'keterangan', title : 'Keterangan', width : 150, sortable:true }
				]]
		});

		// Setup Form
		$('#form_master').setupForm([
			{ name: 'bulan', type: 'text', size: 'short'},
			{ name: 'tahun', type: 'text', size: 'short'},
			{ name: 'tanggal', type: 'date', size: 'short'},
		]);
        
        // Set Action Button
        var buttons = [ 
                        // ----- >> Edit Button
					   //  { label: 'Edit', icon: 'edit', onclick: function() {
					   //      var oSel = $('#datagrid').datagrid('getSelected');
					   //      if (oSel == null) {
					   //          $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					   //      } else {
								// loadPage(gs_path + '/' + controller + '/edit/?no_tagihan_listrik='+urlencode(oSel.no_tagihan_listrik));
					   //      } 
					   //  }},
					    { label: 'Print to Excel', icon: 'print', onclick: function() {
					    	var tanggal = $('#tanggal').val();
					    	window.location = gs_path + '/isp_print_excel/invoice_tak_berlangganan/?tanggal='+tanggal;
					    }},

						// ----- >> Download Button
						
						// ----- >> SP Button
					    ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
    });
//--><!]]></script>

    
<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
        	<tr><td class="label" style="width:70px">Tanggal</td><td><input id="tanggal" /></td></tr>
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                    <a href="#" class="easyui-linkbutton" iconCls="icon-blank-file" onclick="$('#fm_search').resetForm(); return false;">Reset</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>